package com.common.baselibrary.log;

/**
 * Created by zhangjianhui401 on 16/7/20.
 */
public class LogWriterProxy {

    private static final String TAG = "LogWriter";

    private static ILogWriter mLogWriter = null;

    public static void setLogWriter(ILogWriter logWriter) {
        mLogWriter = logWriter;
    }

    /**
     * 写日志
     *
     * @param logType  日志类型：Native / H5
     * @param logLevel 日志级别
     * @param msgInfo  日志内容
     */
    public static void writeLog(String logType, int logLevel, String msgInfo) {
        if (mLogWriter != null) {
            mLogWriter.writeLog(logType, logLevel, msgInfo);
        }
    }

    /**
     * 立即保存所有日志
     */
    public static void writeLogNow(String logType, int logLevel, String msgInfo) {
        if (mLogWriter != null) {
            mLogWriter.writeLogNow(logType, logLevel, msgInfo);
        }
    }

    /**
     * 释放资源
     */
    public static void release() {
        if (mLogWriter != null) {
            mLogWriter.release();
        }
    }

}
